<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary 
  x:Class="OpenLS.Chart.UI.PlotAreaResources"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:chart="http://schemas.Kherty.com/office/2007/chart"
  xmlns:drawing2="clr-namespace:OpenLS.Drawing.UI;assembly=OpenLS.Drawing.UI"
  xmlns:chartui="clr-namespace:OpenLS.Chart.UI"
  xmlns:Internals="clr-namespace:OpenLS.Chart.UI.Internals"
  xmlns:Internals1="clr-namespace:OpenLS.Drawing.UI.Internals;assembly=OpenLS.Drawing.UI"
    >
  <ResourceDictionary.MergedDictionaries>
    <chartui:ChartHelperResources/>
  </ResourceDictionary.MergedDictionaries>
    <DataTemplate DataType="{x:Type chart:PlotArea}">
        <Grid Name="grid" Style="{x:Static chartui:ChartHelperResources.FocusableByClickStyle}" chartui:ChartElement.PlotArea="{Binding}"
          Background="Transparent">
            <Grid.CommandBindings>
                <CommandBinding Command="{x:Static chartui:ChartCommands.FormatPlotArea}"
                        Executed="OnFormatPlotArea" CanExecute="Always" />
            </Grid.CommandBindings>
            <Grid.ContextMenu>
                <ContextMenu>
                    <MenuItem Command="{x:Static chartui:ChartCommands.FormatPlotArea}" />
                </ContextMenu>
            </Grid.ContextMenu>
            <Rectangle Fill="Transparent"></Rectangle>
                <ContentPresenter Content="{Binding Path=Charts[0]}" Margin="2 7 2 0"/>
        </Grid>
    </DataTemplate>
    <DataTemplate DataType="{x:Type chart:PlotArea}" x:Key="PlotAreaBackgroundTemplate">
        <Rectangle Style="{x:Static chartui:ShapedObjectResources.ShapedObjectStyle}" Name="rect"
            StrokeDashArray="{Binding RelativeSource={RelativeSource Self}, Path=(drawing2:DrawingElement.ShapeProperties).LineProperties.LineDashProperties, Converter={x:Static Internals:ChartConverters.LineDashPropertiesToStrokeDashArrayConverter}}"
            StrokeEndLineCap="{Binding RelativeSource={RelativeSource Self} , Path=(drawing2:DrawingElement.ShapeProperties).LineProperties.LineCap, Converter={x:Static Internals1:DrawingConverters.LineCapConverter}}"
            StrokeStartLineCap="{Binding RelativeSource={RelativeSource Self} ,Path=(drawing2:DrawingElement.ShapeProperties).LineProperties.LineCap, Converter={x:Static Internals1:DrawingConverters.LineCapConverter}}"
            StrokeThickness="{Binding RelativeSource={RelativeSource Self} ,Path=(drawing2:DrawingElement.ShapeProperties).LineProperties.Width, FallbackValue=0}"
            >
            <Rectangle.Fill>
                    <MultiBinding Converter="{x:Static Internals:ChartConverters.FillPropertiesToBrushConverter}">
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ShapeProperties).FillProperties"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.Theme).ColorScheme"/>
                    </MultiBinding>
            </Rectangle.Fill>
            <Rectangle.Stroke>
                    <MultiBinding Converter="{x:Static  Internals:ChartConverters.LineFillPropertiesSchemeIndexToBrushConverter}">
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ShapeProperties).LineProperties.LineFillProperties"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)"/>
                    </MultiBinding>
            </Rectangle.Stroke>
        </Rectangle>
        <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding Path=ShapeProperties.FillProperties, FallbackValue={x:Null}}" Value="{x:Null}">
            <Setter Property ="Fill" TargetName="rect">
                <Setter.Value>
                    <MultiBinding Converter="{x:Static Internals:ChartConverters.ColorBaseToBrushConverter}">
                        <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.Style).PlotAreaColor"/>
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.Theme).ColorScheme"/>
                        <Binding Source="debug3"/>
                    </MultiBinding>
                </Setter.Value>
            </Setter>
            </DataTrigger>
        </DataTemplate.Triggers>

    </DataTemplate>

</ResourceDictionary>